package draftMate.player;

public class Hitter implements Comparable<Hitter>{
	public static final int AB = 0;
	public static final int H = 1;
	public static final int HR = 2;
	public static final int R = 3;
	public static final int RBI = 4;
	public static final int S = 5;
	public static final int NUM_STATS = 6;
	public static final int NAME = 6;
	
	String name;
	int stats[];
	int compField;
	
	public Hitter(String name, int ab, int hits, int hr, int runs, int rbi,
			int steals) {
		super();
		this.name = name;
		stats = new int[NUM_STATS];
		stats[AB]= ab;
		stats[H] = hits;
		stats[HR] = hr;
		stats[R] = runs;
		stats[RBI] = rbi;
		stats[S] = steals;
		compField = NAME;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public int getAb() {
		return stats[AB];
	}
	public void setAb(int ab) {
		stats[AB] = ab;
	}
	public int getHits() {
		return stats[H];
	}
	public void setHits(int hits) {
		stats[H] = hits;
	}
	public int getHr() {
		return stats[HR];
	}
	public void setHr(int hr) {
		stats[HR] = hr;
	}
	public int getRuns() {
		return stats[R];
	}
	public void setRuns(int runs) {
		stats[R] = runs;
	}
	public int getRbi() {
		return stats[RBI];
	}
	public void setRbi(int rbi) {
		stats[RBI] = rbi;
	}
	public int getSteals() {
		return stats[S];
	}
	public void setSteals(int steals) {
		stats[S] = steals;
	}

	public int compareTo(Hitter h, int compField) {
		if (compField == NAME) { 
			return name.compareTo(h.name);
		}
		
		if (this.stats[compField] < h.stats[compField]) {
			return -1;
		}
		
		if (this.stats[compField] == h.stats[compField]) {
			return 0;
		}
		
		return 1;
	}
	
	public String toString() {
		return (name + "\t" + stats[AB] + "\t" + stats[H] + "\t" + stats[HR] + "\t" +
							stats[R] + "\t" + stats[RBI] + "\t" + stats[S]);
	}
}
